<template>
    <div>
      <h3>这是第六个demo</h3>
      <p>我叫{{person.name}},今年{{person.age}}</p>
      <button @click="changeName">修改姓名</button>
      <button @click="changeAge">修改年龄</button>
    </div>
  </template>
  
  <script setup lang="ts" name="Demo6">
  import { ref, reactive,toRefs,toRef } from "vue";
  let person = reactive({
    name: "孙悟空",
    age: 20,
  });
  let name1 = toRef(person,'name')
  console.log(name1,'哈哈')
  function changeName() {
      name1.value = '哪吒'
  }
  function changeAge() {
    person.age = 7;
  }
  </script>
  <style lang="scss" scoped></style>